<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width">
<title>小帅丶基于BootDo二次开发的项目</title>
<link href="<%= request.getContextPath() %>/css/loginnew/style.css" rel="stylesheet" type="text/css" />
<script src="<%=path%>/js/jquery-1.8.3.min.js"></script>
</head>
<script language="javascript" type="text/javascript">
	
	
		function retset(){
			document.getElementById('name').value="";
			document.getElementById('password').value="";
		}
		
		function  login(){
			if($("#name").val()==""){
				$("#error").html("<font color='red'>用户名不能为空!</font>");
				return false;
			}
			if($("#password").val()==""){
				$("#error").html("<font color='red'>密码不能为空!</font>");
				return false;
			}
			$.ajax({
				url:'<%=path%>/login/login' ,
				data:{name:$("#name").val(), password:$("#password").val()},
				type:'POST',
				dataType:'json',
				success:function(res) {
					var oper = res.oper;
					//登录失败
					if(oper == 'f') {
						alert(res.msg);
						return;
					}else{
						window.location.href="<%=path%>/login/index";
					}
				}
			});
		}
		function cspan(){
			$("#error").html("");
		}
	
   </script>
<body>
    <h1><b>小帅丶IT-学习系统</b></h1>
	<div class="login-form">
		<div class="head-info">
			<label class="lbl-1"></label> <label class="lbl-2"></label> <label
				class="lbl-3"></label>
		</div>
		<div class="clear"></div>
		<div class="avtar">
			<img src="<%= request.getContextPath() %>/img/avtar.png">
		</div>
		<div>
			<input class="text" placeholder="用户名" type="text" id="name" name="su.username" onchange="cspan();">
			<input class="pwd" placeholder="密码" type="password" id="password" name="su.password" onchange="cspan();">
			<br/>
			<span id="error"></span>
		</div>
		<div class="signin">
			<input class="login" value="登录系统" type="submit" id="loginSubmit" onclick="login();">
		</div>
	</div>
	<div class="copy-rights">2016-2017 © 基于BootDo二次开发的</div>
</body>
</html>
